//
//  PpLanguageSwitchVC.swift
//  Palmpilot
//
//  Created by 杨伟毅 on 2018/10/19.
//  Copyright © 2018年 杨伟毅. All rights reserved.
//

import UIKit

class PpLanguageSwitchVC: PpBaseViewController,UITableViewDelegate,UITableViewDataSource {
    let baseTableView = UITableView()
    let titleArr = [PpLanguageSwitchTool.getString(key: "chinese"),PpLanguageSwitchTool.getString(key: "English")]
    typealias PpSwitchBlcok = (Int) ->()
    var PpSwiftchSelected:PpSwitchBlcok?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        baseTableView.frame = self.view.frame
        baseTableView.delegate = self
        baseTableView.dataSource = self
        self.view.addSubview(baseTableView)
        baseTableView.tableFooterView = UIView()
        baseTableView.register(UITableViewCell.classForCoder(), forCellReuseIdentifier: "baseCell")
        // Do any additional setup after loading the view.
    }
    func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return titleArr.count
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let baseCell : UITableViewCell? = tableView.dequeueReusableCell(withIdentifier: "baseCell", for: indexPath)
        baseCell?.textLabel?.text = titleArr[indexPath.row]
        return baseCell!
    }
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        if PpSwiftchSelected != nil {
            PpSwiftchSelected!(indexPath.row)
        }
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
